package jannex.sql;

import jannex.JannexException;
import jannex.mapping.ResultSetHandler;
import jannex.query.QueryBuilder;

import java.io.PrintWriter;
import java.util.logging.Logger;

public interface JxDataSource extends javax.sql.DataSource {

    Query query(String sql) throws JannexException;

    <E> QueryBuilder<E> queryBuilder(Class<E> elementClass) throws JannexException;

    <E> QueryBuilder<E> queryBuilder(ResultSetHandler<E> handler) throws JannexException;

    /**
     * Cached version of meta data, with only non-parametrized static results.
     */
    JxDatabaseMetaData getCachedMetaData() throws JannexException;

    JxDatabaseMetaData getMetaData() throws JannexException;

    @Override
    JxConnection getConnection() throws JannexException;

    @Override
    JxConnection getConnection(String username, String password) throws JannexException;

    @Override
    PrintWriter getLogWriter() throws JannexException;

    @Override
    void setLogWriter(PrintWriter out) throws JannexException;

    @Override
    void setLoginTimeout(int seconds) throws JannexException;

    @Override
    int getLoginTimeout() throws JannexException;

    @Override
    Logger getParentLogger() throws JannexException;

    @Override
    <T> T unwrap(Class<T> iface) throws JannexException;

    @Override
    boolean isWrapperFor(Class<?> iface) throws JannexException;

}
